import React from 'react'
// 函数组件
/**
 * 声明式
 * 表达式
 */

const TabContent = (props) => {
  const { cityArr, tabConentIndex, handleContentClick } = props
  return (
    <ul>
      {cityArr.map((item, index) => {
        return (
          <li
            key={item.name}
            className={index === tabConentIndex ? 'active' : ''}
            onClick={() => {
              handleContentClick && handleContentClick(index)
            }}
          >
            {item.name}
          </li>
        )
      })}
    </ul>
  )
}

export default TabContent
